<?php

class BDealcallbackGeneral extends UWorkletBehavior {

	public function properties() {
		return array(
			'custom' => array('type' => 'UForm',
				'elements' => array(
					'dummy1' => '<h4>' . $this->t('Deal thank you Url') . '</h4>',
					'callbackUrl' => array('type' => 'text',
						'hint' => $this->t('All active buyers will be forwarded to this url.')),
					'anchorText' => array('type' => 'text'),
				), 'model' => $this->model(),
		));
	}

	public function afterConfig() {
		$this->getOwner()->insertAfter('limitPerUser', $this->properties());
	}

	public function model() {
		static $model;
		if (!isset($model)) {
			$model = MDealcallback::model()->findByPk($this->getOwner()->model->id);
			if (!$model) {
				$model = new MDealcallback;
				$model->id = $this->getOwner()->model->id;
			}
		}
		return $model;
	}

}